package chapter6.No6_1_立即加载_饿汉模式.demo5;

/**
 * Created by Administrator on 2016/11/25.
 */
public class MyObject {
    private static MyObject object;

    private MyObject() {
    }

    public static MyObject getInstance() {
        synchronized (MyObject.class) {
            if (object == null) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                object = new MyObject();
            }
        }
        return object;
    }
}
